﻿(function (jsu) {
    jsu.ask.feedback = function (options) {
        var $this = this;
        jsu.ajax({
            url: "feedback.html",
            success: function(html)
            {
                for (var i = 0; i < $this.length; i++) {
                    var divparent = document.createElement("div");
                    var css = "position: absolute; ";
                    if (options["width"] != null)
                    {
                        css += "width: " + options["width"] + "px;";
                    }
                    if (options["height"] != null) {
                        css += "height: " + options["height"] + "px;";
                    }
                    if (options["left"] != null) {
                        css += "left: " + options["left"] + "px;";
                    }
                    if (options["top"] != null) {
                        css += "top: " + options["top"] + "px;";
                    }
                    divparent.innerHTML = html;
                    divparent.setAttribute("style", css);
                    $this[i].appendChild(divparent);//.innerHTML;
                    jsu.selectorElement("#closeX").onclick(function () {
                        divparent.parentElement.innerHTML = "";
                    });
                    if(options["title"] != null)
                    {
                        jsu.selectorElement("#title").setText(options["title"]);
                    }
                    if(options["button"] != null)
                    {
                        jsu.selectorElement("#btnSend").setText(options["button"]);
                    }
                }
            }
        });
    };
})(jsu);